package cn.cloud.jianghai.orderservice.consumer;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @author Jiang.h
 * created 2022/6/1 12:42
 */
@Slf4j
@Component
@RocketMQMessageListener(consumerGroup = "order-service" , topic = "user-service-topic")
public class UserConsumer implements RocketMQListener<MessageExt> {

    @Override
    public void onMessage(MessageExt messageExt) {

        log.info("订单模块消费成功, 消费数据: {}", JSON.toJSONString(messageExt));
    }
}
